//     https://www.nowcoder.com/questionTerminal/c55f4f15cc3f4ff0adede7f9c69fa0c1




#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[50];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        while (a[i] % 2 == 0)
            a[i] /= 2;
    }

    int flag = 1;
    for (int i = 1; i < n; i++)
    {
        if (a[i] != a[i - 1])
        {
            flag = 0;
            break;
        }
    }

    printf("%s\n", flag ? "YES" : "NO");
    return 0;
}